<template>
    <div class="ontheway">
        <div class="searchFormBox">
            <el-form ref="searchForm" :model="searchForm" :rules="searchRules" :inline="true" size="mini">  
                <el-form-item>
                    <el-input v-model="searchForm.plateNumber" clearable placeholder="请输入车牌号"></el-input>
                </el-form-item>
                 <el-form-item>
                    <el-input v-model="searchForm.equipment" clearable placeholder="请输入设备号"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-date-picker clearable v-model="searchForm.startTime" type="datetime" placeholder="开始日期和时间" size="small"></el-date-picker>
                </el-form-item>
                <el-form-item>
                    <el-date-picker clearable v-model="searchForm.endTime" type="datetime" placeholder="结束日期和时间" size="small"></el-date-picker>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="searchBtn">查询</el-button>
                </el-form-item>
            </el-form>
        </div>
        <trainComponent ref="child" :groundStartTime='groundStartTime' :groundEndTime="groundEndTime" :childMsg="childMsg" :equipment="equipment"></trainComponent>
    </div>
</template>

<script>
import trainComponent from './track-query.vue'
export default {
    data() {
        return {
            searchForm: {
                // plateNumber: '陕YH0009',
               
                // startTime: '2020-07-25 09:00:00',
                // endTime: '2020-07-26 09:00:00',
                equipment:'14146426882',
                plateNumber: '',
                startTime: '2020-10-20 00:00:00',
                endTime: '2020-10-20 12:00:00',
            },
            searchRules: {

            },
            showSearchForm: false,
            childMsg: '',
            equipment:'',
            groundStartTime: '',
            groundEndTime: '',
        }
    },
    components: {
        trainComponent
    },
    methods: {
        searchBtn() {
            // 表单验证
            this.equipment = this.searchForm.equipment
            this.childMsg = this.searchForm.plateNumber
            this.groundStartTime = this.searchForm.startTime
            this.groundEndTime = this.searchForm.endTime
            setTimeout(()=>{
              this.$refs.child.search_step2()  
            },500)
           
        }
    }
}
</script>

<style lang="scss" scope>
.ontheway {
    width: 100%;
    height: 100%;
    position: relative;
    .searchFormBox {
        position: absolute;
        z-index: 9999999999999999;
        top: 5%;
        left: 5%;
    }
}
</style>